let add_vect v1 v2 =
   let len = min (Array.length v1) (Array.length v2) in
   let res = Array.create len 0.0 in
   for i = 0 to len - 1 do
     res.(i) <- v1.(i) +. v2.(i)
   done;
   res;;

let eq_vect v1 v2 =
  let len  = Array.length v1
  and len2 = Array.length v2 in
  if len <> len2 then
    false
  else
    let rec check i =
      if i >= len then
        true
      else
        if v1.(i) = v2.(i) then check (i+1) else false
    in
    check 0
;;

if eq_vect (add_vect [| 1.0; 2.0 |] [| 3.0; 4.0 |]) [|4.; 6.|] then
  print_string "[|1.0;2.0|] + [|3.0;4.0|] = [|4.0;6.0|], Yes!\n"
else
  assert false
;;
